package org.dtrd.modules.record.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.dtrd.config.system.Constant;
import org.dtrd.modules.record.entity.bean.StatisticsBean;
import org.dtrd.modules.record.entity.po.DtrdEntRdSigninHeightWeight;

import java.util.List;
import java.util.Map;

public interface DtrdEntRdHeightWeightMapper extends BaseMapper<DtrdEntRdSigninHeightWeight> {

    List<DtrdEntRdSigninHeightWeight> getBmiDataForCharts(@Param("patientId") int patientId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    List<DtrdEntRdSigninHeightWeight> getAllHeightWeightByPage(@Param("patientId") int patientId,
                                                               @Param("pageStart") int pageStart,
                                                               @Param("pageSize") int pageSize);

    Integer getHeightWeightRecordCount(@Param("patientId") int patientId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    List<DtrdEntRdSigninHeightWeight> getAllHeightWeightBetweenTimeAndPage(@Param("patientId") int patientId,
                                                                           @Param("startDate") String startDate,
                                                                           @Param("endDate") String endDate,
                                                                           @Param("pageStart") int pageStart,
                                                                           @Param("pageSize") int pageSize);

    List<DtrdEntRdSigninHeightWeight> getAllHeightWeightByUserAndDate(@Param("patientId") int patientId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    Map<String, String> getWeightBmiDataForChartsInApp(@Param("patientId") int patientId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    StatisticsBean getHeightWeightStatisticsBean(@Param("patientId") int patientId, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("bmiHigh") float bmiHigh, @Param("bmiLow") float bmiLow);

    Float getAvgWeight(@Param("patientId") Integer patientId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    Integer getAvgBmi(@Param("patientId") Integer patientId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    /**
     * 获取打卡记录中最早的一条数据
     * @param patientId
     * @param heightWeight
     * @return
     */
    Float getFirstHeightWeightRecord(@Param("patientId") Integer patientId,@Param("heightWeight") Constant.HEIGHT_WEIGHT heightWeight);
}